package com.xcl.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@NoArgsConstructor
@AllArgsConstructor
@Data
public class User {
    private Integer id;

    @NotBlank(message = "用户名不能为空")
    @Size(min = 4, max = 16,message = "用户名长度要求4-16位")
    private String userName;

    @NotBlank(message = "密码不能为空")
    @Pattern(regexp = "^\\S{4,16}$",message = "密码长度要求4-16位")
    private String password;

    @Email(message = "邮箱格式不正确")
    private String email;

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

}
